<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        编写一个函数，计算任意两个数字之间所能组成的奇数个数，数字必须是个位数 
        <br>比如： 计算0-3之间能组成的奇数个是01、03、11、13、21、23、31、33
    </div>
    <input type="text" id="num1">
    <input type="text" id="num2">
    <button id="btn">点击</button>
    <div id="res"></div>
    <script>
        function isOdd (a) {
            if ( a % 2 == 1 ) {
                return true ;
            } else {
                return false ;
            }
        }
        function formOdd (a,b) {
            var res = parseInt( String(a) + String(b) );
            if (isOdd(res)) {
                return true ;
            } else {
                return false ;
            }
        }
        function fromAtob (a,b) {
            var count = 0 ;
            for( var i = a ; i <= b ; i++ ){
                for ( var j = a ; j <= b ; j ++ ){
                    if ( formOdd(i,j) ) {
                        count ++ ;
                    }
                }
            }
            return count ;
        }
        var numEle1 = document.getElementById("num1");
        var numEle2 = document.getElementById("num2");
        var btn = document.getElementById("btn");
        btn.onclick = function () {
            var a = numEle1.value ; 
            var b = numEle2.value ;
            document.getElementById("res").innerHTML = fromAtob(a,b);
        }
    </script>
</body>
</html>